Release 10.1A: OpenEdge Development:
Java Open Clients


Accessing temp-table array fields

In the 4GL, fields in a temp-table can be defined with an extent value that creates a one-dimensional array of the specified data type, with the number of elements specified by the extent. JDBC result sets do not support arrays.

An array field in a Progress temp-table can be viewed as a result set in two different ways. In the flat model, each array element becomes a separate column of the table. In the array model, each array is a single column of the table, with each array element being accessed by an index on the array column. The array model matches how Progress handles array fields.

For Java clients, there are access methods to support both models. These methods access field values and meta data of an output ResultSet.

For input, the proxy assumes the fields use the flat column model. For output, your application can access array fields using either the flat column model or array model. For more information, see the "Accessing TABLE or TABLE-HANDLE parameters as OUTPUT" section.

The following examples use the Java flat model meta data methods getColumnType() and getColumnCount() and the array model methods getFieldProType() and getFieldCount(). These examples illustrate the use of a temp-table with three fields in a Java client application, where the second field is an array of 12 elements.

Using the flat model

The flat model methods behave like this:

Since all elements of an array field have the same meta data information, getColumnType(2) through getColumnType(13) return the same value.

Using the array model

The array model methods behave like this:

In this model, since all elements of an array field have the same meta data information, it is necessary to pass only the field index (without an array item index) to these meta data methods. For methods that get a field value, each method has an extra parameter to specify an array index. For example, the method to get the value of a field as an object is:

getObject(int fieldNum, int arrayIndex) 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095